package com.soecode.lyf.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.soecode.lyf.dao.CommetDao;
import com.soecode.lyf.entity.Comment;
import com.soecode.lyf.service.CommetService;

@Service
public class CommetServiceimpl implements CommetService {

	@Autowired
	private CommetDao commentdao;
	
	@Override
	public List<Comment> selectAll(int sortType){ // 查询所有问题
		if(sortType == 0) {
		return commentdao.selectAll();
		}else {
		return commentdao.selectAllBytime();	
		}
	}
	@Override
	public int savePost(Comment cmnt) { // 提交问题
		return commentdao.savePost(cmnt);
	}
	public int reduceIntegral(String userid){
		return commentdao.reduceIntegral(userid);
	}
	@Override
	public List<Comment> selectMyAll(String userid){ // 查询我的所有问题
		return commentdao.selectMyAll(userid);
	}
	
	@Override
	public List getPostDetail(String questionid, String userid) { // 根据问题id查询问题详情
		return commentdao.getPostDetail(questionid,userid);
	}
	
	@Override
	public List<Comment> getCommentList(String questionid, String adopt) { // 根据问题id查询评论
		return commentdao.getCommentList(questionid,adopt);
	}
	
	@Override
	public List<Comment> getReplyList(String questionid, String userid) { // 根据评论id查询评论
		return commentdao.getReplyList(questionid,userid);
	}
	
	@Override
	public List<Comment> getQuestionPrase(String userid) { // 根据评论id查询问题点赞集合
		return commentdao.getQuestionPrase(userid);
	}
	
	@Override
	public List<Comment> getCommentPrase(String userid) { // 根据评论id查询评论点赞集合
		return commentdao.getCommentPrase(userid);
	}
	
	@Override
	public List<Comment> getReplyPrase(String userid) { // 根据评论id查询回复点赞集合
		return commentdao.getReplyPrase(userid);
	}
	
	@Override
	public int postEnjoy(String uuid, String userid,int questionid) { // 问题点赞
		return commentdao.postEnjoy(uuid,questionid,userid);
	}
	@Override
	public int commentEnjoy(String uuid, String userid,int commentid) { // 评论点赞
		return commentdao.commentEnjoy(uuid,commentid,userid);
	}
	@Override
	public int replyEnjoy(String uuid, String userid,int replyid) { // 回复点赞
		return commentdao.replyEnjoy(uuid,replyid,userid);
	}
	@Override
	public int postEnjoyQuit(String userid,int questionid) { // 问题取消点赞
		return commentdao.postEnjoyQuit(userid,questionid);
	}
	@Override
	public int CommentEnjoyQuit(String userid,int commentid) { // 评论取消点赞
		return commentdao.CommentEnjoyQuit(userid,commentid);
	}
	@Override
	public int ReplyEnjoyQuit(String userid,int commentid) { // 回复取消点赞
		return commentdao.ReplyEnjoyQuit(userid,commentid);
	}
	@Override
	public int addEnjoyNum(int questionid) { // 问题点赞+1
		return commentdao.addEnjoyNum(questionid);
	}
	@Override
	public int addCommentEnjoyNum(int commentid, String userid) { // 评论点赞+1
		return commentdao.addCommentEnjoyNum(commentid, userid);
	}
	@Override
	public int addReplyEnjoyNum(int replyid, String userid) { // 回复点赞+1
		return commentdao.addReplyEnjoyNum(replyid, userid);
	}
	@Override
	public int reduceEnjoyNum(int questionid) { // 问题点赞-1
		return commentdao.reduceEnjoyNum(questionid);
	}
	@Override
	public int reduceCommentEnjoyNum(int commentid, String userid) { // 评论点赞-1
		return commentdao.reduceCommentEnjoyNum(commentid, userid);
	}
	@Override
	public int reduceReplyEnjoyNum(int replyid, String userid) { // 回复点赞-1
		return commentdao.reduceReplyEnjoyNum(replyid, userid);
	}
	@Override
	public int addCommentNum(int questionid) { // 问题评论+1
		return commentdao.addCommentNum(questionid);
	}
	@Override
	public int toComment(Comment cmnt) { // 提交评论
		return commentdao.toComment(cmnt);
	}
	@Override
	public Map selectComment(int commentId) { // 查询刚提交的评论
		return commentdao.selectComment(commentId);
	}
	@Override
	public String selectReplyUserid(int commentId) { // 查询被回复人的userid
		return commentdao.selectReplyUserid(commentId);
	}
	@Override
	public int toReply(Comment cmnt) { // 提交回复
		return commentdao.toReply(cmnt);
	}
	@Override
	public int addReplyNum(int commentid) { // 回复数字+1
		return commentdao.addReplyNum(commentid);
	}
	@Override
	public HashMap getReplyInfo(int replyid) { // 查询回复内容
		return commentdao.getReplyInfo(replyid);
	}
}
